<template>
  <div>
    <h4>退款管理</h4>
    <p>这里将显示用户的退单申请记录和状态。</p>
    <el-table :data="tasks.cancellations" style="width: 100%">
       <el-table-column prop="orderNo" label="订单号" width="150"></el-table-column>
      <el-table-column prop="orderTitle" label="任务标题" width="200"></el-table-column>
        <el-table-column prop="techType" label="程序类型"></el-table-column>
      <el-table-column prop="refundAmount" label="退款金额" width="120"></el-table-column>
      <el-table-column prop="refundReason" label="退单理由" width="180"></el-table-column>
      <el-table-column label="状态" width="120">
        <template slot-scope="scope">
          <el-tag :type="statusTag(scope.row.orderStatus)" >已退款</el-tag>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="reviewComment" label="审核意见"></el-table-column> -->
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="pageNum"
      :limit.sync="pageSize"
      @pagination="getChargebacks"
    />
  </div>
</template>

<script>
import { listRefunds } from "@/api/system/task";
import Pagination from "@/components/Pagination";

export default {
  name: "CancellationMgmt",
  components: { Pagination },
  data() {
    return {
      // 总条数
      total: 0,
      // 当前页数
      pageNum: 1,
      // 每页显示条数
      pageSize: 10,
      tasks: {
        cancellations: [],
      }
    };
  },
   created() {
    this.getChargebacks();
  },
  methods: {
    getChargebacks() {
      listRefunds({ pageNum: this.pageNum, pageSize: this.pageSize }).then(response => {
        this.tasks.cancellations = response.rows;
        this.total = response.total;
      });
    },
    statusTag(status) {
        if (status === '4') return 'danger';
        return 'info';
    },
  }
};
</script> 